package com.ruoyi.access.service.impl;

import com.ruoyi.access.domain.AccessControlRule;
import com.ruoyi.access.mapper.AccessControlMapper;
import com.ruoyi.access.service.IAccessControlRuleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AccessControlRuleServiceImpl implements IAccessControlRuleService {

    @Resource
    private AccessControlMapper mapper;

    @Override
    public List<AccessControlRule> listAllRules() {
        return mapper.selectAllRules();
    }

    @Override
    public AccessControlRule getRuleById(Long ruleId) {
        return mapper.selectRuleById(ruleId);
    }

    @Override
    public int addRule(AccessControlRule rule) {
        return mapper.insertRule(rule);
    }

    @Override
    public int updateRule(AccessControlRule rule) {
        return mapper.updateRule(rule);
    }

    @Override
    public int deleteRule(Long ruleId) {
        return mapper.deleteRuleById(ruleId);
    }
}
